package com.cooldatasoft.taskManager.component;

import com.cooldatasoft.domain.model.Project;
import com.cooldatasoft.domain.model.Task;
import com.cooldatasoft.domain.model.User;
import com.vaadin.ui.Window.Notification;

public class TaskManagerNotification extends Notification{

	private static final long serialVersionUID = 1L;

	public TaskManagerNotification(String notify) {
		super(notify);
	}
	
	public static Notification showTableNotification(String header, User user) {
		
		String contentTable = "<br />" + "<hr />" +
							  "<table style='font-size: 17px; font-weight: normal;'>" + 
									"<tr>" +
										"<td style='width: 120px;'> <b>Name</b> </td>" +
										"<td align = 'right' style='width: 140px;'>" + user.getName() + " " + user.getSurname() + "</td>" +
									"</tr>" +
									"<tr>" +
										"<td style='width: 120px;'> <b>Email</b> </td>" +
										"<td align = 'right' style='width: 140px;'>" + user.getEmail() + "</td>" +
									"</tr>" +									
									"<tr>" +
										"<td style='width: 120px;'> <b>Activated</b> </td>" +
										"<td align = 'right' style='width: 140px;'>" + user.isActivated() + "</td>" +
									"</tr>" +
									"<tr>" +
										"<td style='width: 120px;'>  <b>Specialities</b> </td>" +
										"<td align = 'right' style='width: 140px;'>" + user.getSpecialties() + "</td>" +
									"</tr>" +
							  "</table>";
		
		Notification notification = new Notification(header, contentTable, Notification.TYPE_TRAY_NOTIFICATION, true);
		notification.setPosition(POSITION_CENTERED);
		notification.setDelayMsec(3000);
		
		return notification;
	}
	
	public static Notification showTaskNotification(String header, Task task) {
		
		String contentTable = "<br />" + "<hr />" +
							  "<table style='font-size: 17px; font-weight: normal;'>" + 
									"<tr>" +
										"<td style='width: 120px;'> <b>Name</b> </td>" +
										"<td align = 'right' style='width: 140px;'>" + task.getTaskName() + "</td>" +
									"</tr>" +
									"<tr>" +
										"<td style='width: 120px;'> <b>Description</b> </td>" +
										"<td align = 'right' style='width: 140px;'>" + task.getTaskDescription() + "</td>" +
									"</tr>" +									
									"<tr>" +
										"<td style='width: 120px;'> <b>Type</b> </td>" +
										"<td align = 'right' style='width: 140px;'>" + task.getTaskType() + "</td>" +
									"</tr>" +
									"<tr>" +
										"<td style='width: 120px;'> <b>Status</b> </td>" +
										"<td align = 'right' style='width: 140px;'>" + task.getTaskStatus() + "</td>" +
									"</tr>" +
							  "</table>";
		
		Notification notification = new Notification(header, contentTable, Notification.TYPE_TRAY_NOTIFICATION, true);
		notification.setPosition(POSITION_CENTERED);
		notification.setDelayMsec(3000);
		
		return notification;
	}
	
public static Notification showTaskReviewNotification(String header, Task task) {
		
		String contentTable = "<br />" + "<hr />" +
							  "<table style='font-size: 17px; font-weight: normal;'>" + 
									"<tr>" +
										"<td style='width: 80px;'> <b>Name</b> </td>" +
										"<td align = 'right' style='width: 180px;'>" + task.getTaskName() + "</td>" +
									"</tr>" +
									"<tr>" +
										"<td style='width: 120px;'> <b>Description</b> </td>" +
										"<td align = 'right' style='width: 140px;'>" + task.getTaskDescription() + "</td>" +
									"</tr>" +									
									"<tr>" +
										"<td style='width: 120px;'> <b>Type</b> </td>" +
										"<td align = 'right' style='width: 140px;'>" + task.getTaskType() + "</td>" +
									"</tr>" +
									"<tr>" +
										"<td style='width: 120px;'> <b>Status</b> </td>" +
										"<td align = 'right' style='width: 140px;'>" + task.getTaskStatus() + "</td>" +
									"</tr>" +
									"<tr>" +
										"<td style='width: 80px;'> <b>Reviewer</b> </td>" +
										"<td align = 'right' style='width: 180px;'>" + task.getReviewer() + "</td>" +
									"</tr>" +									
									"<tr>" +
										"<td style='width: 80px;'> <b>Review</b> </td>" +
										"<td align = 'right' style='width: 180px;'>" + task.getTaskReview() + "</td>" +
									"</tr>" +
							  "</table>";
		
		Notification notification = new Notification(header, contentTable, Notification.TYPE_TRAY_NOTIFICATION, true);
		notification.setPosition(POSITION_CENTERED);
		notification.setDelayMsec(3000);
		
		return notification;
	}
	
	public static Notification showProjectNotification(String header, Project project) {
		
		String contentTable = "<br />" + "<hr />" +
							  "<table style='font-size: 17px; font-weight: normal;'>" + 
									"<tr>" +
										"<td style='width: 120px;'> <b>Name</b> </td>" +
										"<td align = 'right' style='width: 140px;'>" + project.getName() + "</td>" +
									"</tr>" +
									"<tr>" +
										"<td style='width: 120px;'> <b>Description</b> </td>" +
										"<td align = 'right' style='width: 140px;'>" + project.getDescription() + "</td>" +
									"</tr>" +									
									"<tr>" +
										"<td style='width: 120px;'> <b>Platform</b> </td>" +
										"<td align = 'right' style='width: 140px;'>" + project.getPlatform()+ "</td>" +
									"</tr>" +
									"<tr>" +
										"<td style='width: 120px;'> <b>Created</b> </td>" +
										"<td align = 'right' style='width: 140px;'>" + project.getCreated()+ "</td>" +
									"</tr>" +
									"<tr>" +
										"<td style='width: 120px;'> <b>Finish date</b> </td>" +
										"<td align = 'right' style='width: 140px;'>" + project.getFinished() + "</td>" +
									"</tr>" +
									"<tr>" +
										"<td style='width: 120px;'> <b>Status</b> </td>" +
										"<td align = 'right' style='width: 140px;'>" + project.getStatus() + "</td>" +
									"</tr>" +
							  "</table>";
		
		Notification notification = new Notification(header, contentTable, Notification.TYPE_TRAY_NOTIFICATION, true);
		notification.setPosition(POSITION_CENTERED);
		notification.setDelayMsec(-1);
		
		return notification;
	}
}
